# 习题7-1

vehicle=input("What kind of vehicle would you like to try?")

print('Ok, I will show you the series of '
      +vehicle
      +', this way plese.')

# 习题7-2 输入数字，加入判断
number=input("Vous avez combien de personne?")
number=int(number)
if number>=8:
    print("Je suis desole, il n'y a pas assez de place.")
else:
    print("Par ici, s'il vous plait.")

## 习题7-3 10的整数倍
question='Tell me a number.'
question+='\nThen I will show you if it is multiple of ten.'
number=input(question)

number=int(number)  ##这个转换必须有！！！

if number % 10 == 0:
    print('Yes,it is!')
else:
    print('No, it is not.')

# 7-4

print('输入你想要的配料，输入quit退出')
topping=''
while topping != 'quit': #用中文输入法输入符号，会有红色下划线
    topping=input("What would you like to add on you pizza?")
    if topping != 'quit':
        print('add some '+topping)

# 7-5 while询问年龄 见7-6



# 7-6 三个出口

## 1while条件测试结束循环

## 判断退出，''定义一个空变量，
## 当负负得正的时候，实行while，input，
## 如果不等于quit打印，打印，继续循环
## 等于quit不打印，循环结束

print('输入年龄，得到票价，*号退出')
age=''

while age!='*':
    age=input('How old are you？')
    if age != '*':
        age=int(age)
        if age<0:
            print('别闹，重新输入')
            continue
        elif age>=0 and age<3:
            price=0
        elif age>=3 and age<=12:
            price=10
        elif age>12:
            price=15
        print('You admission cost is '+price.__str__()+'$.')

print('输入年龄，得到票价，*号退出')

## 2active测试循环

active = True

while active:
    age=input('How old are you？')
    if age != '*':
        age=int(age)
        if age<0:
            print('别闹，重新输入')
            continue
        elif age>=0 and age<3:
            price=0
        elif age>=3 and age<=12:
            price=10
        elif age>12:
            price=15
        print('You admission cost is '+price.__str__()+'$.')
        ## 这里必须有.str
    else:
        active = False

## break


while True:  ### 这里直接用True
    age=input('How old are you？')
    if age != '*':
        age=int(age)
        if age<0:
            print('别闹，重新输入')
            continue
        elif age>=0 and age<3:
            price=0
        elif age>=3 and age<=12:
            price=10
        elif age>12:
            price=15
        print('You admission cost is '+price.__str__()+'$.')
        ## 这里必须有.str
    else:
        break

# 7-7 无线循环
# n=1
# while True:
#     print(n)
#     n+=1

# 7-8 熟食店

sandwich_orders=['蛋黄三明治','奶酪火腿三明治','三文鱼三明治']
finished_sandwiches=[]

while sandwich_orders:
    sandwich=sandwich_orders.pop()
    finished_sandwiches.append(sandwich)

print('finished sandwiches:')
for sandwich in finished_sandwiches:
    print(sandwich)

# 习题 7-9 五香牛肉

sandwich_orders=['五香牛肉','蛋黄','奶酪','三文鱼','五香牛肉','五香牛肉']

while '五香牛肉' in sandwich_orders:
    sandwich_orders.remove('五香牛肉')

for sandwich in sandwich_orders:
    print(sandwich)

# 习题 7-10

name_places={}

print('问卷调查，任何时候，打"你奏凯"退出')

while True:
    name=input("您的名字")
    if name == '你奏凯':
        break
    else:
        place=input("您最想去的地方？")
        if place=='你奏凯':
            break
        else:
            name_places[name]=place

print('调查结束，结果为：')

for name, place in name_places.items():
    print(name+'最想去的地方:'+place+'。')


